# Maintainer: Andrew Chadwick <a.t.chadwick@gmail.com>

_realname=mypaint
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.0.0
pkgrel=2
arch=('any')
pkgdesc="Simple drawing & painting program that works well with Wacom-style graphics tablets (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-adwaita-icon-theme"
         "${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-gsettings-desktop-schemas"
         "${MINGW_PACKAGE_PREFIX}-gtk3"
         "${MINGW_PACKAGE_PREFIX}-hicolor-icon-theme"
         "${MINGW_PACKAGE_PREFIX}-json-c"
         "${MINGW_PACKAGE_PREFIX}-lcms2"
         "${MINGW_PACKAGE_PREFIX}-libmypaint"
         "${MINGW_PACKAGE_PREFIX}-librsvg"
         "${MINGW_PACKAGE_PREFIX}-mypaint-brushes2"
         "${MINGW_PACKAGE_PREFIX}-python-cairo"
         "${MINGW_PACKAGE_PREFIX}-python-gobject"
         "${MINGW_PACKAGE_PREFIX}-python-numpy")
makedepends=("${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-swig")
options=('strip' '!debug' 'staticlibs')
license=("GPL2" "ISC")
url="http://mypaint.org"
install=mypaint-${CARCH}.install
source=(https://github.com/mypaint/mypaint/releases/download/v${pkgver}/mypaint-${pkgver}.tar.xz
        '1058.patch')
sha256sums=('d1d67866e342938c1e84b42da10bbed5f613f7e216f800fcc7c0e20200074a5e'
            '7570761ded119a23d9b1a353db1258572661df91c067f3a7904e4bfee5d1b1b2')

prepare() {
    cd "${srcdir}/${_realname}-${pkgver}"

    patch -p1 -i "${srcdir}"/1058.patch
}

build() {
    cd "${srcdir}/${_realname}-${pkgver}"

    ${MINGW_PREFIX}/bin/python3 setup.py build
}

package() {
    cd "${srcdir}/${_realname}-${pkgver}"

    MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
        ${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1

    install -Dm644 COPYING \
        "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING.mypaint"
    install -Dm644 Licenses.md \
        "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/Licenses.md"
    install -Dm644 Licenses.dep5 \
        "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/Licenses.dep5"
}
